﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:shmp_styles="clr-namespace:SharpMap.Styles;assembly=SharpMap"
    xmlns:shmpwpf="clr-namespace:SharpMap.Presentation.Wpf"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    xmlns:cnv="clr-namespace:SharpMap.Presentation.Wpf.Converters"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <DataTemplate x:Key="{ComponentResourceKey 
                         TypeInTargetAssembly={x:Type shmpwpf:LayerStyleView},  
                        ResourceId={x:Type shmp_styles:SolidStyleBrush} }">
        <StackPanel Orientation="Horizontal">
            <TextBox Text="{Binding Value, 
                            Converter={x:Static cnv:BrushConverter.Instance}
                ,NotifyOnSourceUpdated=True}"/>
        </StackPanel>
    </DataTemplate>
 
    <DataTemplate x:Key="{ComponentResourceKey 
                         TypeInTargetAssembly={x:Type shmpwpf:LayerStyleView},  
                        ResourceId={x:Type sys:Boolean} }">
        <CheckBox IsChecked="{Binding Value, Mode=TwoWay, NotifyOnSourceUpdated=True}" />
    </DataTemplate>

    <DataTemplate x:Key="{ComponentResourceKey 
                         TypeInTargetAssembly={x:Type shmpwpf:LayerStyleView},  
                        ResourceId={x:Type sys:Double} }">
        <TextBox Text="{Binding Value, Mode=TwoWay, NotifyOnSourceUpdated=True}" />
    </DataTemplate>

    <DataTemplate 
        x:Key="{ComponentResourceKey 
                        TypeInTargetAssembly={x:Type shmpwpf:LayerStyleView},  
                        ResourceId={x:Type shmp_styles:StylePen} }">
        <StackPanel>
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="Width: "/>
            <TextBox 
                     Text="{Binding Value.Width,
                NotifyOnSourceUpdated=True}"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="Color: "/>
            <TextBox  Text="{Binding Value.BackgroundBrush, 
                            Converter={x:Static cnv:BrushConverter.Instance}
                ,NotifyOnSourceUpdated=True}"/>
            </StackPanel>
        </StackPanel>

    </DataTemplate>


    <DataTemplate x:Key="{ComponentResourceKey 
        TypeInTargetAssembly={x:Type shmpwpf:LayerStyleView}, ResourceId={x:Type sys:Enum}}">
        <ComboBox SelectedValue="{Binding Path=Value}">
            <ComboBox.ItemsSource>
                <Binding Path="Value">
                    <Binding.Converter>
                        <cnv:EnumValueConverter />
                    </Binding.Converter>
                </Binding>
            </ComboBox.ItemsSource>
        </ComboBox>
    </DataTemplate>

    <DataTemplate x:Key="{ComponentResourceKey 
                         TypeInTargetAssembly={x:Type shmpwpf:LayerStyleView},  
                         ResourceId='DefaultValueTemplate' }">
        <TextBox Text="{Binding Value, Mode=TwoWay, NotifyOnSourceUpdated=True}" />
    </DataTemplate>

</ResourceDictionary>